<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<title>My JSP 'index.jsp' starting page</title>



		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		
		<link type="text/css" rel="Stylesheet" href="../resources/css/cityInformation.css" />

		<script type="text/javascript"
			src="http://api.map.baidu.com/api?v=1.3"></script>

	</head>

	<body>
		<div>
			<%@ include file="header.jsp"%>
		</div>
		<div id="body">
			<div id="mapContainer">
			</div>
			<div id="informationContainer">
				<table>
					<tr>
						<td>
							信息类别
						</td>
						<td>
							出发城市
						</td>
						<td>
							出发点名称
						</td>
						<td>
							目的地
						</td>
						<td>
							目的点名称
						</td>
						<td>
							出发时间
						</td>
						<td>
							座位总数
						</td>
						<td>
							预订座位数
						</td>
						<td>
							状态
						</td>
					</tr>
					<c:forEach items="${informations.object}" var="information">
						<tr>
							<td>
								<c:choose>
									<c:when test="${information.type eq '01'}">
										车主发布
									</c:when>
									<c:when test="${information.type eq '02'}">
										乘客发布
									</c:when>
								</c:choose>
							</td>
							<c:forEach items="${information.addresses}" var="address">
								<c:if test="${address.type eq '01'}">
									<td>
										<c:out value="${address.city}"/>
									</td>
									<td>
										<c:out value="${address.pointName}"/>
									</td>	
								</c:if>
							</c:forEach>
							<c:forEach items="${information.addresses}" var="address">
								<c:if test="${address.type eq '03'}">
									<td>
										<c:out value="${address.city}"/>
									</td>
									<td>
										<c:out value="${address.pointName}"/>
									</td>	
								</c:if>
							</c:forEach>
							<td>
								<c:out value="${information.departureTime}"/>
							</td>
							<td>
								<c:out value="${information.seatNumber}"/>
							</td>
							<td>
								<c:out value="${information.bookedSeatNumber}"/>
							</td>
							<td>
								<c:if test="${information.status eq '01'}">
									有效
								</c:if>
								<c:if test="${information.status eq '02'}">
									过期
								</c:if>
							</td>
							<td>
								<a
								href="detailInformation.do?informationID=${information.informationId}">详细信息</a>
							</td>
						</tr>
						</c:forEach>
				</table>
			</div>
			<div>
				<pg:pager url="cityInformationView.do" items="${informations.items}"
					maxPageItems="10" export="currentPageNumber=pageNumber">
					<pg:param name="pageSize" value="10" />
					<pg:first>
						<a href="${pageUrl}&index=${pageNumber}&city=${city}">首页</a>
					</pg:first>
					<pg:prev>
						<a href="${pageUrl }&index=${pageNumber }&city=${city}">上一页</a>
					</pg:prev>
					<pg:pages>
						<c:choose>
							<c:when test="${pageNumber eq pi.pageNo}">
								<font color="red">${pageNumber }</font>
							</c:when>
							<c:otherwise>
								<a href="${pageUrl }&index=${pageNumber }&city=${city}">${pageNumber
									}</a>
							</c:otherwise>
						</c:choose>
					</pg:pages>
					<pg:next>
						<a href="${pageUrl }&index=${pageNumber }&city=${city}">下一页</a>
					</pg:next>
					<pg:last>
						<a href="${pageUrl }&index=${pageNumber }&city=${city}">尾页</a>
					</pg:last>
				</pg:pager>
			</div>
		</div>
	</body>
</html>

<script type="text/javascript">
	function myFun(result) {
		var cityName = result.name;
	}
	var myCity = new BMap.LocalCity();
	myCity.get(myFun);
</script>
